
var ideaListViews = {
	getViews : function(){
		return {

			nav : Ti.UI.iPhone.createNavigationGroup({
				window: 
					Ti.UI.createWindow({
						barColor:'#333',
						backgroundImage:'../img/background2.png',
						
						rightNavButton: Titanium.UI.createButton({
							systemButton:Titanium.UI.iPhone.SystemButton.INFO_LIGHT
						})
						
					})
			}),
			
			tabbedBar : Ti.UI.createTabbedBar({
				labels:[L("TorrentsEnEspera"), L("TorrentsEnCurs"),L("TorrentsFinalitzats")],
				backgroundColor:'#333',
				style:Ti.UI.iPhone.SystemButtonStyle.BAR,
				height:32,
				index:1,
				font:{fontSize:12}
			}),
			
			activityIndicatorView : Ti.UI.createView({
				left:0,
				right:0,
				top:0,
				bottom:0,
				backgroundColor:'#000',
				opacity:0.8,
				visible:false
			}),
			
			activityIndicator : Ti.UI.createActivityIndicator({
				top:160,
				height:60,
				width:'auto',
				color:'#FFFFFF',
				style:Ti.UI.iPhone.ActivityIndicatorStyle.BIG,
				message:L("CarregantTorrent"),
				visible:true
			}),
			
			waitingTorrentTableView : Ti.UI.createTableView({
				opacity:0.9,
				separatorStyle:0,
				backgroundColor:'transparent',
				minRowHeight:60,
				maxRowHeight:100,
				visible:false
			}),
			
			inCourseTorrentTableView : Ti.UI.createTableView({
				opacity:0.9,
				separatorStyle:0,
				backgroundColor:'transparent',
				minRowHeight:60,
				maxRowHeight:120,
				visible:true // visible per defecte
			}),
			
			doneTorrentTableView : Ti.UI.createTableView({
				opacity:0.9,
				separatorStyle:0,
				backgroundColor:'transparent',
				minRowHeight:60,
				maxRowHeight:120,
				visible:false
			})
				
		};
	},
	
	getIdeaWindowByData : function (idIdea){
		return Ti.UI.createWindow({
			url:'../window/ideaDetailsWindow.js',
			backgroundImage:'../img/background2.png',
		    barColor:'#333',
		    navBarHidden:false,
		    idIdea:idIdea,
		    titleControl:Ti.UI.createTabbedBar({
	    		labels:[L("Idea"), L("Solucions"), L("Comentaris")],
	    		backgroundColor:'#333',
	    		style:Ti.UI.iPhone.SystemButtonStyle.BAR,
	    		height:32,
	    		index:0
		    })/*,
		    rightNavButton: Titanium.UI.createButton({
				systemButton:Titanium.UI.iPhone.SystemButton.INFO_LIGHT
			})*/
			
		});
	},
	
	makeRow : function (ideaObj){
		
		var idIdea = ideaObj.id;
		var titol =  ideaObj.tt;
		var noVotats = ideaObj.noVotats;
		var leftImage = '';
		
		
		var ideaRowItem = Ti.UI.createTableViewRow({
			opacity:0,
			backgroundColor:'transparent',
			selectedBackgroundColor:'#333',
			idIdea:idIdea,
			height:'auto',
			
			className:"rowIdea"
		});
		
		if (noVotats > 0){
			ideaRowItem.rightImage ='../img/disclosureArrow.png';
		}else{
			ideaRowItem.rightImage ='../img/disclosureArrowFull.png';
		}
		
		var titolIdea = Ti.UI.createLabel({ 
			left:10,
			top:5,
			bottom:5,
			height:'auto',
			width:'auto',
			text:'#'+idIdea + ": "+titol,
			color:'#FFF',
			font:{fontSize:15}
		});
		ideaRowItem.add(titolIdea);
		
		if(ideaObj.nou == 1){
			ideaRowItem.leftImage = '../img/new.png';
			titolIdea.left = 50;
		}else if(ideaObj.canviat == 1){
			ideaRowItem.leftImage = '../img/updated.png';
			titolIdea.left = 50;
		}
		
		return ideaRowItem;
	},
	
	makeNoTorrentsRow : function (){
		var torrentRowItem = Ti.UI.createTableViewRow({
			opacity:0,
			backgroundColor:'transparent',
			selectedBackgroundColor:'transparent',
			touchEnabled:false, 
			selectionStyle:'none', 
			top:1,
			bottom:1,
			idIdea:null,
			className:"rowIdeaBlank"
		});
		
		var torrent_titol = Ti.UI.createLabel({
			left:10,
			top:0,
			height:40,
			text:L("NoHiHaTorrents"),
			color:'#FFF',
			font:{fontSize:15}
		});
		torrentRowItem.add(torrent_titol);
		
		return torrentRowItem;
	}
		
};